<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">
<h:head>
	<title>#{message.bemvindo}</title>
	<link href="css/cotasul.css" type="text/css" rel="stylesheet" />
	<script>
		function reposicionaNext() {
			var maskHeight = jQuery(document).height();
			var maskWidth = jQuery(window).width();
			jQuery('#pNovoUser').css({
				'top' : 10
			});
		}

		function reposicionaPrevious() {
			var maskHeight = jQuery(document).height();
			var maskWidth = jQuery(window).width();
			jQuery('#pNovoUser').css({
				'top' : 200
			});
		}
	</script>
</h:head>
<h:body style="background: #fafbfe;">
	<p:growl id="growl" showDetail="true" showSummary="true" life="3000" />
	<p:ajaxStatus onstart="statusDialog.show();"
		onsuccess="statusDialog.hide();" />
	<p:dialog modal="true" widgetVar="statusDialog" draggable="false"
		closable="false" resizable="false">
		<p:graphicImage value="img/login_loader.gif" />
	</p:dialog>
	<div class="divTopo"></div>
	<!-- link do CSS  http://cssdesk.com/87GUT  -->
	<div class="divCorpo">
		<div class="divLogin">
			<h:form>
				<p:panel id="loginPanel" header="#{message.label_autentica}"
					style="margin-bottom:100px;">
					<h:panelGrid id="gridLogin" columns="3">
						<h:outputLabel for="login" value="#{message.label_login}" />
						<p:inputText value="#{usuario.login}" id="login" required="true"
							requiredMessage="#{message.msg_obrigatorio}" />
						<p:message for="login" />
						<h:outputLabel for="senha" value="#{message.label_senha}" />
						<p:password value="#{usuario.senha}" id="senha" required="true"
							feedback="false" requiredMessage="#{message.msg_obrigatorio}" />
						<p:message for="senha" />
					</h:panelGrid>
					<f:facet name="footer">
						<p:commandButton value="#{message.botao_entrar}"
							update=":growl,gridLogin" action="#{indexTela.logar}"
							icon="ui-icon-disk" id="loginBut" />
						<p:commandButton value="Cadastre-se" onclick="wizar.show()"
							ajax="false" type="button" />
					</f:facet>
				</p:panel>
			</h:form>
		</div>
	</div>

	<p:dialog id="pNovoUser" widgetVar="wizar" modal="true" width="500">
		<h:form id="fWizard">

			<p:wizard widgetVar="wiz" flowListener="#{indexTela.onFlowProcess}"
				nextLabel="#{message.botao_proximo}"
				backLabel="#{message.botao_anterior}" showNavBar="false">
				<p:tab id="tab1" title="#{message.label_id}">
					<p:panel header="#{message.header_wizard}">
						<h:messages errorClass="error" />
						<h:panelGrid columns="2" columnClasses="label, value">
							<h:outputText value="#{message.label_vc_e}" />
							<p:selectOneRadio value="#{indexTela.opcao}">
								<f:selectItem itemLabel="#{message.label_fornecedor}"
									itemValue="1" />
								<f:selectItem itemLabel="#{message.label_comprador}"
									itemValue="2" />
								<p:ajax global="false" />
							</p:selectOneRadio>
						</h:panelGrid>
					</p:panel>
					<h:outputLink value="#" onclick="wiz.next();reposicionaNext();">#{message.botao_proximo}</h:outputLink>

				</p:tab>

				<p:tab id="fornece" title="#{message.label_fornecedor}">
					<p:panel header="#{message.label_novo_usuario}">
						<h:messages errorClass="error" />
						<h:panelGrid columns="2" columnClasses="label, value">
							<h:outputText value="#{message.label_razao}" />
							<p:inputText value="#{indexTela.fornecedorNovo.nome}" size="45" />

							<h:outputText value="#{message.label_cnpj}/#{message.label_cpf}" />
							<p:inputText value="#{indexTela.fornecedorNovo.cnpj}" size="20" />

							<h:outputText value="#{message.label_fone}" />
							<p:inputMask mask="(99)9999-9999"
								value="#{indexTela.fornecedorNovo.fone}" size="20" />

							<h:outputText value="#{message.label_fone2}" />
							<p:inputMask mask="(99)9999-9999"
								value="#{indexTela.fornecedorNovo.fone2}" size="20" />

							<h:outputText value="#{message.label_cidade}" />
							<p:inputText value="#{indexTela.user.cidade}" size="25" />

							<h:outputText value="#{message.label_uf}" />
							<p:inputText value="#{indexTela.user.uf}" size="2" />

							<h:outputText value="#{message.label_endereco}" />
							<p:inputText value="#{indexTela.user.endereco}" size="45" />

							<h:outputText value="#{message.label_email}" />
							<p:inputText value="#{indexTela.fornecedorNovo.email}" size="25" />

							<h:outputText value="#{message.label_contato}" />
							<p:inputText value="#{indexTela.fornecedorNovo.contato}"
								size="25" />

							<h:outputLabel value="#{message.label_tipo}"></h:outputLabel>
							<p:selectOneMenu style="margin-right:15px;"
								value="#{indexTela.fornecedorNovo.tipo.codigo}">
								<f:selectItem itemLabel="" itemValue="0" />
								<f:selectItems value="#{indexTela.preencheCombo}" var="tipo"
									itemLabel="#{tipo.descricao}" itemValue="#{tipo.codigo}" />
							</p:selectOneMenu>

							<h:outputText value="#{message.label_login}" />
							<p:inputText value="#{indexTela.user.login}" id="fLogin"
								validator="#{indexTela.validador}" size="25">
								<p:ajax event="blur" update="fLogin" process="@this"
									global="false" />
							</p:inputText>

							<h:outputLabel for="pwd11" value="#{message.label_senha}" />
							<p:password id="pwd11" value="#{indexTela.user.senha}"
								match="pwd22" label="#{message.label_senha}" required="true"
								inline="true" feedback="false" size="25" />

							<h:outputLabel for="pwd22"
								value="#{message.label_confimar_senha}" />
							<p:password id="pwd22" value="#{indexTela.user.senha}"
								label="#{message.label_confimar_senha}" required="true"
								inline="true" feedback="false" size="25" />

							<p:commandButton value="#{message.botao_salvar}" update="fWizard"
								action="#{indexTela.salvar('1')}" oncomplete="wizar.hide()"
								icon="ui-icon-disk" />
						</h:panelGrid>
					</p:panel>
					<h:outputLink value="#" onclick="wiz.back();reposicionaPrevious();">#{message.botao_anterior}</h:outputLink>
				</p:tab>

				<p:tab id="compra" title="#{message.label_comprador}">
					<p:panel header="#{message.label_novo_usuario}">

						<h:messages errorClass="error" />

						<h:panelGrid columns="2" columnClasses="label, value">

							<h:outputText value="#{message.label_razao}" />
							<p:inputText value="#{indexTela.compradorNovo.nome}" size="45" />

							<h:outputText value="#{message.label_cnpj}/#{message.label_cpf}" />
							<p:inputText value="#{indexTela.compradorNovo.cnpj}" size="20" />

							<h:outputText value="#{message.label_fone}" />
							<p:inputMask mask="(99)9999-9999"
								value="#{indexTela.compradorNovo.fone}" size="20" />

							<h:outputText value="#{message.label_fone2}" />
							<p:inputMask mask="(99)9999-9999"
								value="#{indexTela.compradorNovo.fone2}" size="20" />

							<h:outputText value="#{message.label_cidade}" />
							<p:inputText value="#{indexTela.user.cidade}" size="25" />

							<h:outputText value="#{message.label_uf}" />
							<p:inputText value="#{indexTela.user.uf}" size="2" />

							<h:outputText value="#{message.label_endereco}" />
							<p:inputText value="#{indexTela.user.endereco}" size="45" />

							<h:outputText value="#{message.label_email}" />
							<p:inputText value="#{indexTela.compradorNovo.email}" size="25" />

							<h:outputText value="#{message.label_contato}" />
							<p:inputText value="#{indexTela.compradorNovo.contato}" size="25" />

							<h:outputText value="#{message.label_login}" />
							<p:inputText value="#{indexTela.user.login}" id="cLogin"
								validator="#{indexTela.validador}" size="25">
								<p:ajax event="blur" update="cLogin" process="@this"
									global="false" />
							</p:inputText>

							<h:outputLabel for="pwd1" value="#{message.label_senha}" />
							<p:password id="pwd1" value="#{indexTela.user.senha}"
								match="pwd2" label="#{message.label_senha}" required="true"
								inline="true" feedback="false" size="25" />

							<h:outputLabel for="pwd2" value="#{message.label_confimar_senha}" />
							<p:password id="pwd2" value="#{indexTela.user.senha}"
								label="#{message.label_confimar_senha}" required="true"
								inline="true" feedback="false" size="25" />

							<p:commandButton value="#{message.botao_salvar}" update="fWizard"
								action="#{indexTela.salvar('2')}" oncomplete="wizar.hide()"
								icon="ui-icon-disk" />

						</h:panelGrid>
					</p:panel>
					<h:outputLink value="#" onclick="wiz.back();reposicionaPrevious();">#{message.botao_anterior}</h:outputLink>
				</p:tab>


			</p:wizard>


		</h:form>
	</p:dialog>

</h:body>
</html>